from sklearn.datasets._samples_generator import make_blobs
from matplotlib import pyplot as plt
from sklearn.naive_bayes import GaussianNB
import numpy as np

# 生成数据集
data, target = make_blobs(n_samples = 100, centers = 2, cluster_std = 1.5)
plt.scatter(data[:, 0], data[:, 1], c = target, s = 50, cmap = 'RdBu')
# 实例化模型
model = GaussianNB()
# 训练模型
model.fit(data, target)